<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<jsp:include page="../common/ListUIHead.jsp"></jsp:include>
	<title>点餐记录</title>
</head>
<body style="padding:1px 3px 1px 3px;overflow:hidden">
	<div id="main">
		<div position="center">
			<div id="toolBar">
			</div>
			<div id="tableContainer">
			</div>
	    </div>
    </div>
</body>
</html>
<script type="text/javascript">
	$list_editUrl = getPath()+"/meal/record/edit";//编辑及查看url
	$list_addUrl = getPath()+"/meal/record/add";//新增url
	$list_deleteUrl = getPath()+"/meal/record/delete";//删除url
	$list_dataType = "订餐";//数据名称
	$(document).ready(function(){
		$("#main").ligerLayout({});
		tb = $("#toolBar").ligerToolBar({
			items:[
				{id:'add',text:'订餐',click:addRow,icon:'add'},
				{id:'summary',text:'汇总',click:summaryCurrent,icon:'search'},
				{id:'menuBook',text:'菜单管理',click:menuBook,icon:'bluebook'},
				{id:'personMan',text:'人员管理',click:personMan,icon:'customers'},
				{id:'timeMan',text:'餐点管理',click:timeMan,icon:'discuss'}
			]
			});
		$("#toolBar").append(
			'<div style="float:right;padding-right:50px">'
	    	+'	<form onsubmit="searchData();return false;">'	
	    	+'	<table><tr>'
	    	+'	<td><div class="f7" id="mealTime" dataPickerUrl="${base}/framework/dataPicker/list?query=mealTimeQuery" width="410px" height="410px" title="餐点" >'
	        +'		<input dataPicker="value" value="${time.id}" name="time.id" id="time.id" type="hidden" readOnly="readOnly" />'
	        +'		<input dataPicker="name" name="time.name" value="${time.name}" validate="{required:true}" title="餐点" id="time.name" type="text" readOnly="readOnly" ondblclick="openDataPicker(\'mealTime\')"/>'
	    	+'		<strong onclick="clearDataPicker(\'mealTime\')"></strong>'
	    	+'		<span class="p_hov" onclick="openDataPicker(\'mealTime\')"></span>'
	    	+'	</div></td>'
		    +'		<td>'
		    +'		<a class="mini-button" href="javascript:void(0)"><span class="mini-button-low-text" onclick="searchData();return false;">查询</span></a>'
	    	+'	</td></tr></table></form>'
	    	+'</div>'
		);
		$list_dataGrid = $("#tableContainer").ligerGrid($.extend($list_defaultGridParam,{
            columns: [ 
	            {display: '餐点', name: 'mealTime.name', align: 'left', width: 80},
	            {display: '姓名', name: 'mealPerson.name', align: 'left', width: 120},
	            {display: '餐馆', name: 'dishes.restaurant.name', align: 'left', width: 120},
	            {display: '菜式', name: 'dishes.name', align: 'left', width: 120},
	            {display: '价格', name: 'money', align: 'left', width: 120},
	            {display: '操作', name: 'operate', align: 'center', width: 160,render:operateRender}
	        ],
            url:getPath()+'/meal/record/listData',
            parms:{time:'${time.id}'}
        }));
        $list_dataParam['time'] = '${time.id}';
	});
	
	function operateRender(data,filterData){
			return '<a href="javascript:viewRow({id:\''+data.id+'\'});">查看</a>&nbsp;&nbsp;&nbsp;&nbsp;'
				+'<a href="javascript:editRow({id:\''+data.id+'\'});">编辑</a>&nbsp;&nbsp;&nbsp;&nbsp;'
				+'<a href="javascript:deleteRow({id:\''+data.id+'\'});">删除</a>';
	}
	function searchData(){
		$list_dataParam['time'] = $('#time\\.id').val();
		resetList();
	}
	function summaryCurrent(){
		art.dialog.open(getPath()+'/meal/record/summary?time='+$('#time\\.id').val(),{
			title:'汇总',
			lock:true,
			width:460,
			height:320,
			button:[{name:"关闭"}]
		});
	}
	function menuBook(){
		art.dialog.open(getPath()+'/meal/restaurant/list',{
			title:'菜单管理',
			lock:true,
			width:860,
			height:460,
			button:[{name:"关闭"}]
		});
	}
	function personMan(){
		art.dialog.open(getPath()+'/meal/mealPerson/list',{
			title:'人员管理',
			lock:true,
			width:860,
			height:460,
			button:[{name:"关闭"}]
		});
	}
	function timeMan(){
		art.dialog.open(getPath()+'/meal/mealTime/list',{
			title:'餐点管理',
			lock:true,
			width:860,
			height:460,
			button:[{name:"关闭"}]
		});
	}
</script>